package com.spc.car.data.util;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;

@Data
public class PageParam<T> {

    /**
     * 每页显示条数，最大30，默认 20
     */
    @Min(value = 1, message = "每页条数不能小于{value}")
    @Max(value = 30, message = "每页条数不能大于{value}")
    private Integer pageSize = 20;

    /**
     * 当前页，默认1
     */
    @Min(value = 1, message = "当前页不能小于{value}")
    private Integer page = 1;

    public Page<T> getPage() {
        return new Page<T>(this.page, this.pageSize);
    }

}
